﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CreateUser.aspx.cs" Inherits="cs499.Account.Register" %>
<%@ MasterType VirtualPath="~/Site.Master" %>

<asp:Content ID="Content2" ContentPlaceHolderID="NavOptions" runat="server">
    <asp:Button ID="CancelButton" runat="server" PostBackUrl="~/Admin/ListUsers.aspx" Text="Cancel" Width="133px" CausesValidation="False" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="FeaturedContent" runat="server">
    <section class="featured">
        <div class="content-wrapper">
            <h2>Use the form below to create a new account.</h2>
        </div>
    </section>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="MainContent">
    <asp:CreateUserWizard runat="server" ID="RegisterUser" ViewStateMode="Enabled" OnCreatedUser="RegisterUser_CreatedUser" Width="250px" OnCreatingUser="RegisterUser_CreatingUser" AutoGeneratePassword="False" LoginCreatedUser="False" RequireEmail="False">
        <LayoutTemplate>
            <asp:PlaceHolder runat="server" ID="wizardStepPlaceholder" />
            <asp:PlaceHolder runat="server" ID="navigationPlaceholder" />
        </LayoutTemplate>
        <WizardSteps>
            <asp:CreateUserWizardStep runat="server" ID="RegisterUserWizardStep">
                <ContentTemplate>
                    <p class="message-info">
                        Passwords are required to be a minimum of <%: Membership.MinRequiredPasswordLength %> characters in length.
                    </p>
                    <p class="validation-summary-errors">
                        <asp:Literal runat="server" ID="ErrorMessage" />
                    </p>
                    <fieldset>
                        <legend>Registration Form</legend>
                        <ol>
                            <li>
                                <asp:Label ID="Label1" runat="server" AssociatedControlID="userDepartmentSelection">User's department</asp:Label>
                                <asp:DropDownList ID="userDepartmentSelection" runat="server" DataSourceID="userDepartmentDataSource" DataTextField="Name" DataValueField="Id" Height="32px" Width="205px">
                                </asp:DropDownList>
                                <asp:RadioButton ID="usertypeRadioButtonFaculty"  runat="server" Text="Faculty" Checked="True" CssClass="RadioButton1" GroupName="usertypeRadioButton" />
                                <asp:RadioButton ID="usertypeRadioButtonAdmin" runat="server" CssClass="RadioButton1" GroupName="usertypeRadioButton" TabIndex="1" Text="Admin" />
                                <asp:EntityDataSource ID="userDepartmentDataSource" runat="server" ConnectionString="name=Model1Container" DefaultContainerName="Model1Container" EnableFlattening="False" EntitySetName="Departments" EntityTypeFilter="Department">
                                </asp:EntityDataSource>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="userDepartmentSelection"
                                    CssClass="field-validation-error" ErrorMessage="User must belong to a department." />
                            </li>
                            <li>
                                <asp:Label ID="Label2" runat="server" AssociatedControlID="UserName">Email address</asp:Label>
                                <asp:TextBox runat="server" ID="UserName" />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="UserName"
                                    CssClass="field-validation-error" ErrorMessage="The user name field is required." />
                            </li>
                            
                            <li>
                                <asp:Label runat="server" AssociatedControlID="Password">Password</asp:Label>
                                <asp:TextBox runat="server" ID="Password" TextMode="Password" />
                                <asp:RequiredFieldValidator runat="server" ControlToValidate="Password"
                                    CssClass="field-validation-error" ErrorMessage="The password field is required." />
                            </li>
                            <li>
                                <asp:Label runat="server" AssociatedControlID="ConfirmPassword">Confirm password</asp:Label>
                                <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />
                                <asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
                                    CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The confirm password field is required." />
                                <asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
                                    CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." />
                                
                            </li>
                        </ol>
                        <asp:Button runat="server" CommandName="MoveNext" Text="Register" />
                    </fieldset>
                </ContentTemplate>
                <CustomNavigationTemplate />
            </asp:CreateUserWizardStep>
            <asp:CompleteWizardStep runat="server">
                <ContentTemplate>
                    <table>
                        <tr>
                            <td align="center">Complete</td>
                        </tr>
                        <tr>
                            <td>Your account has been successfully created.</td>
                        </tr>
                        <tr>
                            <td align="right">
                                <asp:Button ID="ContinueButton" runat="server" CausesValidation="False" CommandName="Continue" Text="Continue" ValidationGroup="RegisterUser" />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:CompleteWizardStep>
        </WizardSteps>
    </asp:CreateUserWizard>
</asp:Content>